<script>

$(document).ready(function() {
	$("#validatebutton").click(function () {
		
		var email = $("#email").val();
		var key = $("#key").val();
		$.ajax({
		    type: 'POST',
		    url: context+'user/saveconfirm',
		    dataType: 'json',
		    async: false,
		    data:{'email':email,'key':key},
		    success: function(data){
			    if(data['success'])
			    {
			    	$(location).attr('href',context+'user/profil');
			    }
			    else{
			    	 $("#error span").html(data['error']);
				 }
		    },
		    error: function(xhr, status, thrown){
		    	 $("#error span").html(xhr.responseText);
		    }
		});
		return false;
	});
});

</script>

<div class="hero-unit">

<div>

Your validation code is send to email. <?php echo $this->email?>
<br>
Please check you email and enter this code. 
<br>
<div id="error">
     <span></span>
  </div>
   <div>
     Code
      <input id="key" type="text" value="" />
  </div>
  <input id="email" type="hidden" value="<?php echo $this->email?>" />
</div>
<button id="validatebutton">Validate</button>
</div>

 
 </div>

<div class="row">

</div>
